// 用户模块
import { getInfo, setInfo } from '@/utils/storage'

export default {
	namespaced: true, // 为当前模块开启命名空间
	state: () => ({
		userInfo: JSON.parse(uni.getStorageSync('user-info') || '{}')
	}),
	mutations: {
		// 更新登录用户信息
		updateUserInfo (state, { data, callback }) {
			state.userInfo = data
			setInfo(data)
			callback && callback()
		}
	},
	actions: {},
	getters: {}
}
